'''
Created on Apr 24, 2011

@author: Jonathan Herbst
'''
    
from bluetooth import *
import sys

import Messages

_controlDeviceName = "00:80:37:2F:1E:A4"

def BluetoothTest():
    service = find_service(name="SECSControlDevice", address=_controlDeviceName)[0]
    sock=BluetoothSocket( RFCOMM )
    sock.connect((service["host"], service["port"]))
    
    sock.send(Messages.DoorCommand("lsjflsd", Messages.DoorCommand.GRANTACCESSACTION).renderMessage())
    
    sock.close()

if __name__ == "__main__":
    BluetoothTest()